home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / X11 / seyon / ad2c.ok < prev    next >
Text File  |  1995-05-03  |  882b  |  49 lines

  1. #!/bin/sh
  2. #
  3. #    ad2c : Convert app-defaults file to C strings decls.
  4. #
  5. #    George Ferguson, ferguson@cs.rcohester.edu, 12 Nov 1990.
  6. #    19 Mar 1991: gf
  7. #        Made it self-contained.
  8. #    6 Jan 1992: mycroft@gnu.ai.mit.edu (Charles Hannum)
  9. #        Removed use of "-n" and ":read" label since Gnu and
  10. #        IBM sed print pattern space on "n" command. Still works
  11. #        with Sun sed, of course.
  12. #    7 Jan 1992: matthew@sunpix.East.Sun.COM (Matthew Stier)
  13. #        Escape quotes after escaping backslashes.
  14. #    8 Jul 1992: Version 1.6
  15. #
  16.  
  17. sed '
  18. # remove comments
  19. /^!/d
  20. # remove blanks
  21. /^$/d
  22. # escape backslash
  23. s/\\/\\\\/g
  24. # except the line continuation ones
  25. s/\\$//g
  26. # escape quotes
  27. s/"/\\"/g
  28. # add leading quote
  29. s/^/"/
  30. #
  31. : test
  32. /\\$/b slash
  33. s/$/",/
  34. p
  35. d
  36. #
  37. : slash
  38. n
  39. # just like "read" only does not add leading quote
  40. /^!/d
  41. /^$/d
  42. s/"/\\"/g
  43. s/\\\\/\\/g
  44. s/\\n/\\\\n/g
  45. s/\\t/\\\\t/g
  46. s/\\f/\\\\f/g
  47. s/\\b/\\\\b/g
  48. b test' "$@"
  49.